import request from '../utils/request'
// 获取最新商品信息
export const getNewCartGoodes = skuId => {
  return request({
    url: `/goods/stock/${skuId}`,
    method: 'get'
  })
}
// 登录后合并本地购物车
export const mergeLocalCart = data => {
  return request({
    url: '/member/cart/merge',
    method: 'post',
    data
  })
}
// 获取登录后的购物车列表
export const getCartList = () => {
  return request({
    url: '/member/cart',
    method: 'get'
  })
}
// 登录后加入购物车
export const postJoinCart = data => {
  return request({
    url: '/member/cart',
    method: 'post',
    data
  })
}
// 登录后修改购物车商品
export const putCartItem = (id, data) => {
  return request({
    url: `/member/cart/${id}`,
    method: 'put',
    data
  })
}
// 登录后删除商品
export const deleteCartItem = ids => {
  return request({
    url: '/member/cart',
    method: 'delete',
    data: { ids }
  })
}
// 登录后修改全选反选
export const putSeleteds = ({ ids, selected }) => {
  return request({
    url: '/member/cart/selected',
    method: 'put',
    data: { ids, selected }
  })
}
